<template>
  <!--帮助中心  -->
  <div class="support">
    <div class="support_title">帮助中心</div>

    <el-collapse v-model="supportList" @change="handleChange" style="margin-top: 24px;">
      <el-collapse-item :title="item.title" :name="item.title" v-for="(item, index) in supportList" :key="index">
        <div v-html="item.answer" style="text-align: left;"></div>
      </el-collapse-item>
    </el-collapse>
    <!-- <div
      class="support_content"
      v-for="item in supportList"
      :key="item.id"
      @click="enterDetail(item.id)"
    >
      {{ item.title }}
    </div> -->

    <!-- 分页 -->
    <!-- <el-pagination
      background
      @current-change="handleCurrentChange"
      :current-page="pageNo"
      :page-size="pageSize"
      layout="prev, pager, next, jumper"
      :total="total"
      v-if="supportList.length > 0"
    >
    </el-pagination> -->
  </div>
</template>

<script>
export default {
  data() {
    return {
      supportList: [],
      pageNo: 1,
      pageSize: 10,
      total: 0
    };
  },
  created() {
    this.questionList();
  },
  methods: {
    // 问题列表
    async questionList() {
      let params = {
        condition: "",
        pageNo: this.pageNo,
        // pageSize: this.pageSize,
      };
      let res = await this.$apiFun.questionList(params);
      this.supportList = res.result.rows;
      this.supportList = this.supportList.sort((a, b) =>
        a.createdTime > b.createdTime ? -1 : 1
      );
    },
    handleChange(e) {
      console.log(e);
      
    },
    enterDetail(id) {
      console.log(id);
      
      // this.$router.push({
      //   name: "problem_details",
      //   query:{
      //     id
      //   },
      // });
    },

    // 页面切换
    handleCurrentChange(value) {
      this.pageNo = value;
      this.questionList();
    },
  },
};
</script>

<style lang="less" scoped>
.support {
  min-height: 4rem;
  background: #ffffff;
  box-shadow: 0px 3px 20px 0px rgba(230, 230, 230, 0.8);
  border-radius: 10px;
  padding: 0.3rem 0.5rem;
  .support_title {
    text-align: left;
    font-size: 0.24rem;
    font-weight: bold;
    color: #333333;
  }
  .support_content {
    text-align: left;
    font-size: 0.22rem;
    font-weight: 400;
    // text-decoration: underline;
    color: #000;
    margin-top: 0.3rem;
    cursor: pointer;
    &:hover{
      color: #f42551;
    }
  }
  .el-pagination {
    position: relative;
    top: 0;
    text-align: left;
    margin-top: 0.4rem;
    // padding-left: 0.3rem;
    display: flex;
    justify-content: center;
  }
}
// 分页样式
/deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: #f42551;
}
</style>